home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / StringCompare.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  7.8 KB  |  296 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        StringCompare.h
  3.  
  4.      Contains:    Public interfaces for String Comparison and related operations
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __STRINGCOMPARE__
  19. #define __STRINGCOMPARE__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __TEXTCOMMON__
  25. #include <TextCommon.h>
  26. #endif
  27. #ifndef __SCRIPT__
  28. #include <Script.h>
  29. #endif
  30.  
  31.  
  32.  
  33. #if PRAGMA_ONCE
  34. #pragma once
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_STRUCT_ALIGN
  46.     #pragma options align=mac68k
  47. #elif PRAGMA_STRUCT_PACKPUSH
  48.     #pragma pack(push, 2)
  49. #elif PRAGMA_STRUCT_PACK
  50.     #pragma pack(2)
  51. #endif
  52.  
  53. /*
  54.  
  55.     Here are the current System 7 routine names and the translations to the older forms.
  56.     Please use the newer forms in all new code and migrate the older names out of existing
  57.     code as maintenance permits.
  58.     
  59.     NEW NAME                    OLD NAME                    OBSOLETE FORM (no handle)
  60.     
  61.     CompareString (Str255)        IUCompPString (hp only)        IUCompString (hp only)
  62.     CompareText (ptr/len)        IUMagPString                IUMagString
  63.     IdenticalString (Str255)    IUEqualPString (hp only)    IUEqualString  (hp only)
  64.     IdenticalText (ptr/len)        IUMagIDPString                IUMagIDString
  65.     LanguageOrder                IULangOrder
  66.     ScriptOrder                    IUScriptOrder
  67.     StringOrder (Str255)        IUStringOrder (hp only)
  68.     TextOrder (ptr/len)            IUTextOrder
  69.  
  70.     RelString
  71.     CmpString (a only)                    
  72.     EqualString (hp only)
  73.     
  74.     ReplaceText
  75.  
  76. */
  77.  
  78.  
  79. enum {
  80.                                                                 /* Special language code values for Language Order*/
  81.     systemCurLang                = -2,                            /* current (itlbLang) lang for system script*/
  82.     systemDefLang                = -3,                            /* default (table) lang for system script*/
  83.     currentCurLang                = -4,                            /* current (itlbLang) lang for current script*/
  84.     currentDefLang                = -5,                            /* default lang for current script*/
  85.     scriptCurLang                = -6,                            /* current (itlbLang) lang for specified script*/
  86.     scriptDefLang                = -7                            /* default language for a specified script*/
  87. };
  88.  
  89. /* obsolete names*/
  90.  
  91. enum {
  92.     iuSystemCurLang                = -2,
  93.     iuSystemDefLang                = -3,
  94.     iuCurrentCurLang            = -4,
  95.     iuCurrentDefLang            = -5,
  96.     iuScriptCurLang                = -6,
  97.     iuScriptDefLang                = -7
  98. };
  99.  
  100.  
  101. /*
  102.    The following functions are old names, but are required for System 7 PowerPC builds
  103.    because InterfaceLib exports these names, instead of the new ones.
  104. */
  105.  
  106. EXTERN_API( short )
  107. IUMagPString                    (const void *            aPtr,
  108.                                  const void *            bPtr,
  109.                                  short                     aLen,
  110.                                  short                     bLen,
  111.                                  Handle                 itl2Handle)                            THREEWORDINLINE(0x3F3C, 0x001A, 0xA9ED);
  112.  
  113. EXTERN_API( short )
  114. IUMagIDPString                    (const void *            aPtr,
  115.                                  const void *            bPtr,
  116.                                  short                     aLen,
  117.                                  short                     bLen,
  118.                                  Handle                 itl2Handle)                            THREEWORDINLINE(0x3F3C, 0x001C, 0xA9ED);
  119.  
  120. EXTERN_API( short )
  121. IUTextOrder                        (const void *            aPtr,
  122.                                  const void *            bPtr,
  123.                                  short                     aLen,
  124.                                  short                     bLen,
  125.                                  ScriptCode             aScript,
  126.                                  ScriptCode             bScript,
  127.                                  LangCode                 aLang,
  128.                                  LangCode                 bLang)                                THREEWORDINLINE(0x3F3C, 0x0022, 0xA9ED);
  129.  
  130. EXTERN_API( short )
  131. IULangOrder                        (LangCode                 language1,
  132.                                  LangCode                 language2)                            THREEWORDINLINE(0x3F3C, 0x0020, 0xA9ED);
  133.  
  134. EXTERN_API( short )
  135. IUScriptOrder                    (ScriptCode             script1,
  136.                                  ScriptCode             script2)                            THREEWORDINLINE(0x3F3C, 0x001E, 0xA9ED);
  137.  
  138. EXTERN_API( short )
  139. IUCompPString                    (ConstStr255Param         aStr,
  140.                                  ConstStr255Param         bStr,
  141.                                  Handle                 itl2Handle);
  142.  
  143. EXTERN_API( short )
  144. IUEqualPString                    (ConstStr255Param         aStr,
  145.                                  ConstStr255Param         bStr,
  146.                                  Handle                 itl2Handle);
  147.  
  148. EXTERN_API( short )
  149. IUStringOrder                    (ConstStr255Param         aStr,
  150.                                  ConstStr255Param         bStr,
  151.                                  ScriptCode             aScript,
  152.                                  ScriptCode             bScript,
  153.                                  LangCode                 aLang,
  154.                                  LangCode                 bLang);
  155.  
  156. /*
  157.    The following new function name IS exported by InterfaceLib and works on both 68k and
  158.    System 7 PowerPC.
  159. */
  160. EXTERN_API( short )
  161. ScriptOrder                        (ScriptCode             script1,
  162.                                  ScriptCode             script2)                            THREEWORDINLINE(0x3F3C, 0x001E, 0xA9ED);
  163.  
  164. /* For C the other new names are mapped to the old names using #define.*/
  165. #define CompareString(aStr, bStr, itl2Handle) \
  166.          IUCompPString(aStr, bStr, itl2Handle)
  167. #define CompareText(aPtr, bPtr, aLen, bLen, itl2Handle) \
  168.          IUMagPString(aPtr, bPtr, aLen, bLen, itl2Handle)
  169. #define IdenticalString(aStr, bStr, itl2Handle) \
  170.          IUEqualPString(aStr, bStr, itl2Handle)
  171. #define IdenticalText(aPtr, bPtr, aLen, bLen, itl2Handle) \
  172.          IUMagIDPString(aPtr, bPtr, aLen, bLen, itl2Handle)
  173. #define StringOrder(aStr, bStr, aScript, bScript, aLang, bLang) \
  174.          IUStringOrder(aStr, bStr, aScript, bScript, aLang, bLang)
  175. #define TextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang) \
  176.          IUTextOrder(aPtr, bPtr, aLen, bLen, aScript, bScript, aLang, bLang)
  177. #define LanguageOrder(language1, language2) \
  178.          IULangOrder(language1, language2)
  179. /* C glue*/
  180.  
  181. #if CGLUESUPPORTED
  182. #if OLDROUTINENAMES
  183. EXTERN_API_C( short )
  184. iucomppstring                    (const char *            aStr,
  185.                                  const char *            bStr,
  186.                                  Handle                 intlHandle);
  187.  
  188. EXTERN_API_C( short )
  189. iuequalpstring                    (const char *            aStr,
  190.                                  const char *            bStr,
  191.                                  Handle                 intlHandle);
  192.  
  193. EXTERN_API_C( short )
  194. iustringorder                    (const char *            aStr,
  195.                                  const char *            bStr,
  196.                                  ScriptCode             aScript,
  197.                                  ScriptCode             bScript,
  198.                                  LangCode                 aLang,
  199.                                  LangCode                 bLang);
  200.  
  201. #endif  /* OLDROUTINENAMES */
  202.  
  203. #endif  /* CGLUESUPPORTED */
  204.  
  205. /*
  206.    The following new function name IS exported by InterfaceLib and works on both 68k and
  207.    System 7 PowerPC.
  208. */
  209. EXTERN_API( short )
  210. ReplaceText                        (Handle                 baseText,
  211.                                  Handle                 substitutionText,
  212.                                  Str15                     key)                                FOURWORDINLINE(0x2F3C, 0x820C, 0xFFDC, 0xA8B5);
  213.  
  214. EXTERN_API( short )
  215. IUMagString                        (const void *            aPtr,
  216.                                  const void *            bPtr,
  217.                                  short                     aLen,
  218.                                  short                     bLen)                                THREEWORDINLINE(0x3F3C, 0x000A, 0xA9ED);
  219.  
  220. EXTERN_API( short )
  221. IUMagIDString                    (const void *            aPtr,
  222.                                  const void *            bPtr,
  223.                                  short                     aLen,
  224.                                  short                     bLen)                                THREEWORDINLINE(0x3F3C, 0x000C, 0xA9ED);
  225.  
  226. EXTERN_API( short )
  227. IUCompString                    (ConstStr255Param         aStr,
  228.                                  ConstStr255Param         bStr);
  229.  
  230. EXTERN_API( short )
  231. IUEqualString                    (ConstStr255Param         aStr,
  232.                                  ConstStr255Param         bStr);
  233.  
  234. #if CGLUESUPPORTED
  235. #if OLDROUTINENAMES
  236. EXTERN_API_C( short )
  237. iucompstring                    (const char *            aStr,
  238.                                  const char *            bStr);
  239.  
  240. EXTERN_API_C( short )
  241. iuequalstring                    (const char *            aStr,
  242.                                  const char *            bStr);
  243.  
  244. #endif  /* OLDROUTINENAMES */
  245.  
  246. #endif  /* CGLUESUPPORTED */
  247.  
  248. EXTERN_API( short )
  249. RelString                        (ConstStr255Param         str1,
  250.                                  ConstStr255Param         str2,
  251.                                  Boolean                 caseSensitive,
  252.                                  Boolean                 diacSensitive);
  253.  
  254. EXTERN_API( Boolean )
  255. EqualString                        (ConstStr255Param         str1,
  256.                                  ConstStr255Param         str2,
  257.                                  Boolean                 caseSensitive,
  258.                                  Boolean                 diacSensitive);
  259.  
  260. #if CGLUESUPPORTED
  261. EXTERN_API_C( short )
  262. relstring                        (const char *            str1,
  263.                                  const char *            str2,
  264.                                  Boolean                 caseSensitive,
  265.                                  Boolean                 diacSensitive);
  266.  
  267. EXTERN_API_C( Boolean )
  268. equalstring                        (const char *            str1,
  269.                                  const char *            str2,
  270.                                  Boolean                 caseSensitive,
  271.                                  Boolean                 diacSensitive);
  272.  
  273. #endif  /* CGLUESUPPORTED */
  274.  
  275.  
  276. #if PRAGMA_STRUCT_ALIGN
  277.     #pragma options align=reset
  278. #elif PRAGMA_STRUCT_PACKPUSH
  279.     #pragma pack(pop)
  280. #elif PRAGMA_STRUCT_PACK
  281.     #pragma pack()
  282. #endif
  283.  
  284. #ifdef PRAGMA_IMPORT_OFF
  285. #pragma import off
  286. #elif PRAGMA_IMPORT
  287. #pragma import reset
  288. #endif
  289.  
  290. #ifdef __cplusplus
  291. }
  292. #endif
  293.  
  294. #endif /* __STRINGCOMPARE__ */
  295.  
  296.